package org.shiwen.week7.answer;

import org.shiwen.week6.friday.Employee;

import java.util.Scanner;

public class Q4 {
    public static void main(String[] args) {
        //生成一个数组用于存放员工类生成的对象，长度由用户定义
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入员工的个数");
        org.shiwen.week6.friday.Employee employee[] = new org.shiwen.week6.friday.Employee[sc.nextInt()];

        for(int i=0;i<employee.length;i++){
            //前面的employee是数组,后面的Employee是构造方法
            employee[i] = new Employee();
            System.out.println("请输入第"+(i+1)+"个员工的姓名");
            employee[i].setName(sc.next());
            System.out.println("请输入第"+(i+1)+"个员工的年龄");
            employee[i].setAge(sc.nextInt());
            System.out.println("请输入第"+(i+1)+"个员工的性别");
            employee[i].setGender(sc.next());
            System.out.println("请输入第"+(i+1)+"个员工的电话");
            employee[i].setPhone(sc.next());
        }

        for (int i = 0; i < employee.length; i++) {
            System.out.println(employee[i].getInfo());
        }
    }
}
